package cn.hx.handsetticketinspection.params;

import com.alibaba.fastjson.JSONObject;

import cn.hx.handsetticketinspection.constant.Constants;
import cn.hx.handsetticketinspection.utils.MapUtils;

/**
 * 设备状态上报参数
 *
 * @Author: HuangMinJie
 * @since: 2021/12/22  14:16
 */
public class DeviceStateReport implements RequestParams {

    private Integer deviceType = Constants.Device_Type;

    private String deviceCode = Constants.getSerialNumber();

    private String stateType;

    private Integer stateValue;

    public Integer getDeviceType() {
        return deviceType;
    }

    public void setDeviceType(Integer deviceType) {
        this.deviceType = deviceType;
    }

    public String getDeviceCode() {
        return deviceCode;
    }

    public void setDeviceCode(String deviceCode) {
        this.deviceCode = deviceCode;
    }

    public String getStateType() {
        return stateType;
    }

    public void setStateType(String stateType) {
        this.stateType = stateType;
    }

    public Integer getStateValue() {
        return stateValue;
    }

    public void setStateValue(Integer stateValue) {
        this.stateValue = stateValue;
    }

    @Override
    public String toJSONString() {
        return this.toString();
    }

    @Override
    public JSONObject toJSONObject() {
        return JSONObject.parseObject(toString());
    }

    @Override
    public MapUtils toMapUtils() {
        MapUtils map = MapUtils.getHttpInstance();
        map.put("deviceType", this.deviceType);
        map.put("deviceCode", this.deviceCode);
        map.put("stateType", this.stateType);
        map.put("stateValue", this.stateValue);
        return map;
    }

    @Override
    public String toString() {
        return "{" +
                "\"deviceType\":" + deviceType +
                ", \"deviceCode\":\"" + deviceCode + "\"" +
                ", \"stateType\":\"" + stateType + "\"" +
                ", \"stateValue\":" + stateValue + "}";
    }
}
